package com.quanquan.user.service.autoCompute.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.quanquan.user.service.autoCompute.enums.CentType;
import com.quanquan.user.service.autoCompute.enums.OptionType;
import com.quanquan.user.service.autoCompute.enums.StatisticType;
import org.hibernate.annotations.Type;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户分组标签
 */

@Entity
@Table(name = "oo_member_label")
public class MemberLabel implements Serializable {

    /**
     * 主键ID
     */
    @Id
    @Column(name = "id", unique = true, length = 32)
    private String id;
    /**
     * 标签规则筛选sql
     */
    @Column(name = "label_rule")
    private String labelRule;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "create_time")
    private Date createTime;
    /**
     * 修改时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "update_time")
    private Date updateTime;
    /**
     * 是否删除
     */
    @Type(type = "yes_no")
    @Column(name = "is_removed")
    private Boolean isRemoved;
    /**
     * 标签归属
     */
    @Column(name = "belonging", length = 36)
    private String belonging;
    /**
     * 包含人数
     */
    @Column(name = "contains_num")
    private Long containsNum;
    /**
     * 同步状态 1.同步中 2.同步完成 0.同步失败
     */
    @Column(name = "syn_status")
    private Integer synStatus;
    /**
     * 标签来源 ： 1.会员表 2.停车记录表 3.消费记录表 4.积分记录表
     */
    @Column(name = "label_from")
    private String labelFrom;

    /**
     * 表名称
     */
    @Column(name = "table_name")
    private String tableName;
    /**
     * 字段类型
     */
    @Column(name = "field_type", length = 16)
    private String fieldType;
    /**
     * 字段名
     */
    @Column(name = "field_name", length = 16)
    private String fieldName;

    @Type(type = "yes_no")
    @Column(name = "use_tmp", columnDefinition = "CHAR(1) DEFAULT 'N'")
    private Boolean useTmp;

    @Column(name = "temp_table")
    private String tempTable;

    @Column(name = "temp_name", length = 16)
    private String tempName;
    /**
     * 操作类型
     */
    @Column(name = "option_type", length = 12)
    @Enumerated(EnumType.STRING)
    private OptionType optionType;

    /**
     * 统计类型
     */
    @Column(name = "statistic_type")
    @Enumerated(EnumType.STRING)
    private StatisticType statisticType;

    /**
     * 积分类型
     */
    @Column(name = "cent_type")
    @Enumerated(EnumType.STRING)
    private CentType centType;

    /**
     * 操作
     */
    @Column(name = "option_str")
    private String option;
    /**
     * 左值
     */
    @Column(name = "left_value", length = 64)
    private String leftValue;
    /**
     * 右值
     */
    @Column(name = "right_value", length = 64)
    private String rightValue;
    /**
     * 左边符号
     */
    @Column(name = "left_symbol", length = 16)
    private String leftSymbol;
    /**
     * 右边符号
     */
    @Column(name = "right_symbol", length = 16)
    private String rightSymbol;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "last_sync_time")
    private Date lastSyncTime;

    public String getTempTable() {
        return tempTable;
    }

    public void setTempTable(String tempTable) {
        this.tempTable = tempTable;
    }

    public String getTempName() {
        return tempName;
    }

    public void setTempName(String tempName) {
        this.tempName = tempName;
    }


    public Boolean getUseTmp() {
        return useTmp;
    }

    public void setUseTmp(Boolean useTmp) {
        this.useTmp = useTmp;
    }

    public Date getLastSyncTime() {
        return lastSyncTime;
    }

    public void setLastSyncTime(Date lastSyncTime) {
        this.lastSyncTime = lastSyncTime;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLabelRule() {
        return labelRule;
    }

    public void setLabelRule(String labelRule) {
        this.labelRule = labelRule;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getIsRemoved() {
        return isRemoved;
    }

    public void setIsRemoved(Boolean removed) {
        isRemoved = removed;
    }

    public String getBelonging() {
        return belonging;
    }

    public void setBelonging(String belonging) {
        this.belonging = belonging;
    }

    public Long getContainsNum() {
        return containsNum;
    }

    public void setContainsNum(Long containsNum) {
        this.containsNum = containsNum;
    }

    public Integer getSynStatus() {
        return synStatus;
    }

    public void setSynStatus(Integer synStatus) {
        this.synStatus = synStatus;
    }

    public String getLabelFrom() {
        return labelFrom;
    }

    public void setLabelFrom(String labelFrom) {
        this.labelFrom = labelFrom;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getLeftValue() {
        return leftValue;
    }

    public void setLeftValue(String leftValue) {
        this.leftValue = leftValue;
    }

    public String getRightValue() {
        return rightValue;
    }

    public void setRightValue(String rightValue) {
        this.rightValue = rightValue;
    }

    public String getLeftSymbol() {
        return leftSymbol;
    }

    public OptionType getOptionType() {
        return optionType;
    }

    public void setOptionType(OptionType optionType) {
        this.optionType = optionType;
    }

    public String getOption() {
        return option;
    }

    public void setOption(String option) {
        this.option = option;
    }

    public void setLeftSymbol(String leftSymbol) {
        this.leftSymbol = leftSymbol;
    }

    public String getRightSymbol() {
        return rightSymbol;
    }

    public void setRightSymbol(String rightSymbol) {
        this.rightSymbol = rightSymbol;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public StatisticType getStatisticType() {
        return statisticType;
    }

    public void setStatisticType(StatisticType statisticType) {
        this.statisticType = statisticType;
    }

    public CentType getCentType() {
        return centType;
    }

    public void setCentType(CentType centType) {
        this.centType = centType;
    }
}
